<div class="span2 search-right"></div>
<% form_tag url_for({:controller=>'documents',:action=>'search'}),
    {:method=>:get, :class=>'search-from'} do -%>
	<div class="serach-field">
	  <%= text_field_tag 'query', params[:query] || t('search.enter_text'),
	    :onfocus=>"if (this.value == '#{t('search.enter_text')}') this.value='';",
	    :onblur=>"if (this.value == '') this.value = '#{t('search.enter_text')}';",
	    :id=>'search-field' %>
	  <span id="search-sep"></span>
  </div>
  <%= submit_tag('', :id=>'search-btn') %>

  <%
  if params[:id] && controller.is_a?(CollectionsController)
    # Current page is Collection show
    @selection = Collection.find(params[:id])
  elsif params[:id] && controller.is_a?(SectionsController)
    # Current page is section show
    @selection = Section.find(params[:id])
  end
  -%>

  <% if @selection -%>
    <div class="span-2">&nbsp;</div>
    <div class="span-22 last">
      <span class="search-option"><%= t('search.range')%></span>
      <%= radio_button_tag 'search_range', 'all' -%>
      <%= label_tag 'search_range_all',
        "<span class='search-option'>#{t('collection.all')}</span>" -%>
      <%= radio_button_tag 'search_range', dom_id(@selection), true -%>
      <%= label_tag "search_range_#{dom_id(@selection)}",
        "<span class='search-option'>#{@selection.title}</span>" -%>
    </div>
  <% end # if -%>

<% end -%><!-- form tag -->

